<template>
  <div class="com-card">
    <div class="card-title">{{ title }}</div>
    <div class="card-value">{{ value }}</div>
    <div class="card-chart">
      <!-- 默认的插槽 -->
      <slot></slot>
    </div>
    <div class="card-line"></div>
    <div class="card-footer">
      <slot name="footer"></slot>
    </div>
  </div>
</template>

<script lang="ts">
// 这是一个公共组件
export default {
  name: "Card",
  props: {
    title: { type: String, default: "" },
    value: { type: String, default: "" },
  },
};
</script>

<style lang="scss" scoped>
.com-card {
  // border: 1px solid red;
  padding: 20px;
  background-color: #fff;
  box-shadow: 2px 2px 10px 2px rgba(0, 0, 0, 0.1);
  .card-title{
    font-size: 12px;
    color: #999;
  }
  .card-value{
    margin:5px 0;
    font-size: 25px;
    letter-spacing: 1px;
  }
  .card-chart{
    height: 50px;
  }
  .card-line {
    border: 1px solid #eee;
    margin: 10px 0;
  }
  .card-footer {
    font-size: 12px;
    color: #666;
  }
}
</style>